package com.keeplearing;

import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class FizzBuzz {
    public static List<String> calc(int n) {
        return IntStream.range(1, n+1)
                .mapToObj(i -> {
                    StringBuilder builder = new StringBuilder();
                    if (i % 3 == 0) {
                        builder.append("Fizz");
                    }

                    if (i % 5 == 0) {
                        builder.append("Buzz");
                    }

                    if (i % 3 != 0 && i % 5 != 0 ) {
                        builder.append(i);
                    }
                    return builder.toString();
                })
        .collect(Collectors.toList());

    }
}
